import { ElMessage, ElMessageBox, ElNotification } from 'element-plus'

export const alertMsg = (code, msg) => {
  switch (code) {
    case 200:
      ElMessage({
        message: msg.value === null? '空消息' : msg.value,
        grouping: true,
        type:'success'
      })
      break
    case 400:
      ElMessage({
        message: msg.value === null? '空消息' : msg.value,
        grouping: true,
        type: 'error'
      })
      break
    case 500:
  }

}
export const alertCode = (code) => {
  if (code === 200) {
    ElNotification({
      title: '结果',
      message: '操作成功',
      type: 'success',
      duration: 3000
    })
  }
  if (code === 400) {
    ElNotification({
      title: '结果',
      message: '操作失败',
      type: 'error',
      duration: 3000
    })
  }
}
export const confirm = (title, msg) => {
  ElMessageBox.confirm(msg, title, {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning',
  })
}
